<?php

/**
 * new actions.
 *
 * @package    blog
 * @subpackage new
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class newActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
      //params 1 - limit , 2 - important:  2 (1-important , 0-no important)
      
      //noticias que se muestarn en el slider      
      $this->blog_news_slider = Doctrine_Core::getTable('BlogNew')->getNewsHome(4,1);
      
      //noticias que se muestran en el index
      $this->blog_news = Doctrine_Core::getTable('BlogNew')->getNewsHome(sfConfig::get('app_news_index'),0);
      
      //params 1 - Limit
      $this->blog_news_most = Doctrine_Core::getTable('BlogNew')->getNewsMost(6);
      
      //params 1 - Limit
      $this->blog_news_most_week = Doctrine_Core::getTable('BlogNew')->getNewsMostWeek(6);
      
      $this->blog_news_atom = Doctrine_Core::getTable('BlogNew')->getNewsPublic();
      
      

     
  }

  public function executeShow(sfWebRequest $request)
  {
     $this->blog_new = $this->getRoute()->getObject(); 
     
     //params 1 - Limit
      $this->blog_news_most = Doctrine_Core::getTable('BlogNew')->getNewsMost(6);
    
      
  }
/*
  public function executeNew(sfWebRequest $request)
  {
    $this->form = new BlogNewForm();
    //$this->embedForm('category', new AnotherForm());
  }

  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST));

    $this->form = new BlogNewForm();

    $this->processForm($request, $this->form);

    $this->setTemplate('new');
  }

  public function executeEdit(sfWebRequest $request)
  {
    $this->forward404Unless($blog_new = Doctrine_Core::getTable('BlogNew')->find(array($request->getParameter('id'))), sprintf('Object blog_new does not exist (%s).', $request->getParameter('id')));
    $this->form = new BlogNewForm($blog_new);
  }

  public function executeUpdate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
    $this->forward404Unless($blog_new = Doctrine_Core::getTable('BlogNew')->find(array($request->getParameter('id'))), sprintf('Object blog_new does not exist (%s).', $request->getParameter('id')));
    $this->form = new BlogNewForm($blog_new);

    $this->processForm($request, $this->form);

    $this->setTemplate('edit');
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($blog_new = Doctrine_Core::getTable('BlogNew')->find(array($request->getParameter('id'))), sprintf('Object blog_new does not exist (%s).', $request->getParameter('id')));
    $blog_new->delete();

    $this->redirect('new/index');
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $blog_new = $form->save();

      $this->redirect('new/edit?id='.$blog_new->getId());
    }
  }
 * 
 */
}
